<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css/aui-slide.css" />
    <title></title>
<style media="screen">
*{ margin: 0 ;padding: 0}
img{border: none}
body{background: #F5F5F5; }
h1,h2,h3,h4,h5,h6{font-weight: normal;}
header {
       width: 100%;  height: 35px;border-radius: 50px;top:0;left: 0;position:relative;z-index: 9999999999999;
   }


   #cont_list .title{ font-size: 14px; height: 52px; border-bottom: 1px solid #F5F5F5; background: #FFF;box-sizing: border-box;}
   #cont_list .title  span{ display: block; float: left; width: 3px; height: 12px; background: #fc8622; line-height: 52px;margin-left: 15px; margin-right: 12px; margin-top: 20px}
   #cont_list .title h3{ float: left; line-height: 56px; color: #333333;font-size:16px;}
    #cont_list .title2{ font-size: 14px; height: 52px; border-bottom: 1px solid #F5F5F5; background: #FFF; margin-top:5px;margin-bottom: -5px;box-sizing: border-box;}
   #cont_list .title2  span{ display: block; float: left; width: 3px; height: 12px; background: #fc8622; line-height: 56px;margin-left: 15px; margin-right: 12px; margin-top: 20px}
   #cont_list .title2 h3{ float: left; line-height: 52px; color: #333333;font-size: 16px;}
   #cont_list .cont_l{ height: 120px; background: #FFF; margin-top: 5px; padding-left: 15px}
   #cont_list .cont_l:nth-child(2){margin-top: 0px}
   #cont_list .cont_l h2{ padding-top: 15px; margin-bottom: 10px;color: #333333; font-size: 13px}
   #cont_list .cont_l h3{ font-size: 12px; color: #999; padding-bottom: 10px;}
   #cont_list .cont_l .cont_l_3,.#cont_list .cont_l2 .cont_l_3{height: 21px;}
   #cont_list .cont_l .cont_l_3 span{ font-size: 12px; color: #999999; padding: 3px 12px; background: #F8F8FA; margin-right: 10px}
   #cont_list .cont_l .time{ float: right; color: #CCCCCC; font-size: 12px; margin-top: -82px; margin-right: 10px}
   #cont_list .cont_l2{ height: 118px; background: #FFF; margin-top: 5px; padding-left: 15px;}
   #cont_list .cont_l2:nth-child(3){margin-top:-50px}
   #cont_list .cont_l2 h2{ padding-top: 21px; margin-bottom: 10px;color: #333333; font-size: 13px}
   #cont_list .cont_l2 h3{ font-size: 12px; color: #999; padding-bottom: 10px;}
   #cont_list .cont_l2 .cont_l_3 span{ font-size: 12px; color: #999999; padding: 3px 12px; background: #F8F8FA; margin-right: 10px   }
   #cont_list .cont_l2 .time{ float: right; color: #CCCCCC; font-size: 12px; margin-top: -82px; margin-right: 10px}
   #nav{ height: 224px; background: #FFF;}
   #nav ul{display: flex}
   #nav ul li{ list-style: none; float: left; width: 30%; margin-left: 3%; height:92px;}
   #nav ul li img{ width: 48px; height:49px;margin: 0 auto;display:block;margin-top:38px;margin-bottom: 13px;box-sizing: border-box;}
   #nav ul li h4{ font-size: 13px; text-align: center; color: #666666;height: 13px;}
   #btn{ position: fixed; top: 20px; width: 100%;  background: red; height: 30px; z-index: 99999}
   #search{ width: 95%; height: 30px; background: #fff; margin: 22px auto;z-index: 100000;border-radius: 12px;overflow: hidden;margin-top: 35px;}
   #search h5{ color: #a39f9c; line-height:30px; margin-left: 10px; float: left;font-size:12px;}
   #search img{ width: 16px; height: 16px; float: right; margin-top: 6px; margin-right: 10px}
   .text-light {
     color: #999;
   }
   .text-dark {
     color: #333 !important;
   }
   .bg-white {
     background: #ffffff;
   }
   .aui-list .aui-list-item-label-icon.label-text {
     align-items: baseline;
     -webkit-align-items: baseline;
   }
   .aui-tab-item {
     width: 2rem;
     margin: 0 auto;
   }



    .bg-dark{height:250px;box-sizing: border-box;}
   .bg-dark img{height: 250px;box-sizing: border-box;}
   .aui-card-list-content{height: 250px!important;box-sizing: border-box;}
   .aui-slide-page-dot{background-color: #fff}
.aui-slide-page-active{background-color: #1abc9c}
</style>
</head>
<body>
  <!-- <button id="btn">123456</button> -->
  <header id="header">
    <div id="search" onclick="search()" tapmode="tapmode">
        <h5>输入您想要的内容</h5>
        <img src="../image/index_search1.png" alt="">
    </div>
  </header>
  <!-- 轮播图 -->
  <section class="aui-card-list" style="margin：0;margin-top:-70px;height:250px;box-sizing: border-box;margin-bottom:0">
    <div class="aui-card-list-content" id="aui-slide" style="height:250px;box-sizing: border-box;">
      <div class="aui-slide-wrap" style="height:250px;box-sizing: border-box;">
          <div class="aui-slide-node bg-dark" >
              <img src="../image/banner.jpg" id="img1"/>
          </div>
          <div class="aui-slide-node bg-dark" >
              <img src="../image/banner.jpg" id="img2"/>
          </div>
          <div class="aui-slide-node bg-dark" >
              <img src="../image/banner.jpg" id="img3"/>
          </div>
      </div>
      <div class="aui-slide-page-wrap"><!--分页容器--></div>
    </div>

  </section>
  <!-- 导航 -->
  <div id="nav">
      <ul>
        <li tapmode onclick="nav_open(1)"><img src="../image/cont_nav1.png"><h4>查看机手</h4></li>
        <li tapmode onclick="nav_open(5)"><img src="../image/cont_nav2.png"><h4 id="xmzx">项目中心</h4></li>
        <li tapmode onclick="nav_open(4)"><img src="../image/cont_nav3.png"><h4>平台简介</h4></li>
      </ul>
      <ul>
        <li tapmode onclick="nav_open(3,'拖车',1)"><img src="../image/cont_nav4.png"><h4>拖车</h4></li>
        <li tapmode onclick="nav_open(3,'加油',2)"><img src="../image/cont_nav5.png"><h4>加油</h4></li>
        <li tapmode onclick="nav_open(3,'维修',3)"><img src="../image/cont_nav6.png"><h4>维修</h4></li>
      </ul>
  </div>
  <div id="cont_list">
      <div class="title">
          <span></span>
          <h3>最新项目</h3>
      </div>
      <div class="cont_l" v-for="site in zxxm" @click="zx_show(site.id)">
            <h2>{{site.title}}</h2>
            <h3>{{site.dizhi}}&nbsp;&nbsp;|&nbsp;<span>{{site.miaoshu}}</span></h3>
            <div class="cont_l_3"><span>{{site.gongqi}}天工期</span><span>{{site.renshu}}人已参与</span><span>距离{{site.juli}}KM</span></div>
            <div class="time">{{site.time}}</div>
      </div>



      <div class="title2">
          <span></span>
          <h3>成功项目</h3>
      </div>
      <div class="cont_l2" v-for="site in cgxm" @click="zx_show(site.id)">
            <h2>{{site.title}}</h2>
            <h3>{{site.dizhi}}&nbsp;&nbsp;|&nbsp;<span>{{site.miaoshu}}</span></h3>
            <div class="cont_l_3"><span>{{site.gongqi}}天工期</span><span>{{site.renshu}}人已参与</span><span>距离{{site.juli}}KM</span></div>
            <div class="time">{{site.time}}</div>
      </div>
      <footer></footer>
  </div>
  </div>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../script/vue.min.js"></script>
<script type="text/javascript" src="../script/aui-slide.js"></script>
<script type="text/javascript" src="../script/aui-tab.js"></script>
<script type="text/javascript">
    apiready = function() {




    //   api.requestPermission({
    //   list:['storage'],
    //   code:1
    // }, function(ret, err){
    //   // api.alert({
    //   //     msg:JSON.stringify(ret)
    //   // });
    // });
      api.setRefreshHeaderInfo({
          loadingImg: 'widget://image/refresh.png',
          bgColor:  'rgba(0,0,0,0)',
          textColor: '#333',
          textDown: '下拉刷新...',
          textUp: '松开刷新...'
      }, function(ret, err) {
        zxxm_ajax();
        cgxm_ajax();
              tongzhi();
              lun_ajax();

      });
      cha_ajax();
zxxm_ajax();
cgxm_ajax();

       var header = $api.byId('header');


    //调整高度
    var heig =-50;
      $api.byId("nav").style.margin=$api.offset( $api.byId('header')).h+ heig+'px 0px 0px 0px';
    //监听返回
     keyback();
    //轮播
    //  lunbo();
    //获取经纬度


if($api.getStorage("lbimg1")){
  $api.attr($api.byId("img1"),'src',$api.getStorage("lbimg1"));
}
if($api.getStorage("lbimg2")){
  $api.attr($api.byId("img2"),'src',$api.getStorage("lbimg2"));
}
if($api.getStorage("lbimg3")){
  $api.attr($api.byId("img1"),'src',$api.getStorage("lbimg3"));
}

     //底部列表
      list = new Vue({
                el: '#cont_list',
                data: $tools.getdata(),
            });
            $tools.datarefresh(list);

    dingshi()


    };
var list;
//轮播
    var slide = new auiSlide({
        container:document.getElementById("aui-slide"),
        // "width":300,
        "height":250,
        "speed":300,
        "pageShow":true,
        "pageStyle":'dot',
        "loop":true,
        'dotPosition':'center',
        "autoPlay" : 3000,
        // currentPage:currentFun
    })
    var tab = new auiTab({
        element:document.getElementById("tab"),
    },function(ret){
        if(ret.index == 1){
          document.getElementById("goods-detail").classList.remove("aui-hide");
          document.getElementById("comment-list").classList.add("aui-hide");
        }else{
          document.getElementById("goods-detail").classList.add("aui-hide");
          document.getElementById("comment-list").classList.remove("aui-hide");
        }
    });

function search(){
  api.openWin({
      name: 'search',
      url: 'widget://html/search/search_win.html',

  });

}


  var xmzx=$api.byId("xmzx").innerHTML
function nav_open(id,test,uid){
      if(id==1){
        if($api.getStorage("shenfen")==3){
          api.toast({
              msg: '商家账号无法访问',
              duration: 2000,
              location: 'bottom'
          });

        }else{
          api.sendEvent({
              name: 'zsygsj',
              extra: {
                  id: 1,
              }
          });

          api.setFrameGroupIndex({
        name: 'group1',
        index: 1
    });
        }




      }else if(id==2){
        if($api.getStorage("shenfen")==3){
          api.toast({
              msg: '商家账号无法访问',
              duration: 2000,
              location: 'bottom'
          });

        }else{
        api.sendEvent({
            name: 'zsygsj',
            extra: {
                id: 3,
            }
        });
        api.setFrameGroupIndex({
      name: 'group1',
      index:3
      });
    }
        }else if(id==3){

          api.openWin({
              name: 'list_zhfw',
              url: 'widget://html/zhfw/list_zhfw.html',
              slidBackEnabled:true,
              pageParam: {
                  name: test,
                  id:uid,
              }
          });


      }
      else if(id==4){
        api.openWin({
            name: 'list_zhfw',
            url: 'widget://html/jianjie/jianjie_win.html',
            slidBackEnabled:true,
            pageParam: {
                name: 'test'
            }
        });


    }
    else if(id==5){

      api.openWin({
          name: 'list_zhfw',
          url: 'widget://html/xuqiuzhongxin/list_zhfw_fram4_win.html',
          slidBackEnabled:true,
          pageParam: {
              name: xmzx
          }
      });


  }
}



function zx_show(id){

  api.openWin({
      name: 'show_xmxq_win',
      url: 'widget://html/xmxq/show_xmxq_win.html',
      pageParam: {
          id:id
      }
  });

}






function keyback() {
        api.addEventListener({
            name: 'keyback'
        }, function(ret, err) {
            api.confirm({
                title: '提示',
                msg: '是否退出应用',
                buttons: ['确定', '取消']
            }, function(ret, err) {
                if (ret.buttonIndex == 1) {
                    api.closeWidget({
                        silent: true
                    });
                }
            });
        });
    }


function jingwei(){
  if($api.getStorage("member")){
    var bMap = api.require('bMap');
      bMap.getLocation({
          accuracy: '100m',
          autoStop: true,
          filter: 1
      }, function(ret, err) {
          if (ret.status) {
              // console.log("获取位置信息成功");
              situation(ret);
          } else {

          }
      });

  }

}

function situation(data){

  api.ajax({
      url: $api.getStorage("backapi")+'/index.php?c=home&m=situation&id='+$api.getStorage("member")+'&lon='+data.lon+'&lat='+data.lat,
      method: 'GET',
  },function(ret, err){
    if(ret){
      // console.log("更新成功");
    }

  });


}





function zxxm_ajax(){
  api.ajax({
      url: $api.getStorage("backapi")+'/index.php?c=home&m=zxxm_ajax&uid='+$api.getStorage("member"),
      method: 'post',
  },function(ret, err){
      if (ret) {
        list.zxxm = ret.status;
        $tools.setData("zxxm",ret.status);
        //  console.log( JSON.stringify( ret ) );
      } else {
          // console.log( JSON.stringify( err ) );
      }
  });
  api.refreshHeaderLoadDone();
}

function cgxm_ajax(){
  api.ajax({
      url: $api.getStorage("backapi")+'/index.php?c=home&m=cgxm_ajax&uid='+$api.getStorage("member"),
      method: 'post',
  },function(ret, err){
      if (ret) {
        list.cgxm = ret.status;
        $tools.setData("cgxm",ret.status);
          // console.log( JSON.stringify( ret ) );
      } else {
          // console.log( JSON.stringify( err ) );
      }
  });
  api.refreshHeaderLoadDone();
}



function tongzhi(){
  api.ajax({
      url: $api.getStorage("backapi")+'/index.php?s=xiangmu&c=home&m=tuisong',
      method: 'post',
      data: {
          values: {
              uid:$api.getStorage("member"),
              sf:$api.getStorage("shenfen")
          }
      }
  },function(ret, err){
    console.log(JSON.stringify(ret));
      if (ret) {
            if($api.getStorage("shenfen")==1){
              for(var i in ret.status){
                  api.notification({
                    notify: {
                        title: "通知",
                        content: ret.status[i].title+"申请参与 "+ret.status[i].name+" 项目",
                    }
                  },function(ret,err){
                    jstuisong()
                  });
              }
            }else if($api.getStorage("shenfen")==2){
              for(var i in ret.status){
                api.notification({
                  notify: {
                      title: "通知",
                      content: ret.status[i].title+"项目被通过",
                  }
                },function(ret,err){
                  jstuisong()
                });

                }
            }

      }
  });
  // jstuisong()

  // api.require('tencentPush').registerPush(function(ret, err) {
  //     if (ret.status) {
  //         console.log("注册成功，token为：" + ret.token);
  //         var tencentPush = api.require('tencentPush');
  //         api.ajax({
  //             url: $api.getStorage("backapi")+'/index.php?s=xiangmu&c=home&m=tuisong',
  //             method: 'post',
  //             data: {
  //                 values: {
  //                     uid:$api.getStorage("member"),
  //                     sf:$api.getStorage("shenfen")
  //                 }
  //             }
  //         },function(ret, err){
  //             if (ret) {
  //             //  console.log(1111111);
  //               console.log(JSON.stringify(ret));
  //         if($api.getStorage("shenfen")==1){
  //
  //           for(var i in ret.status){
  //             var mydata = (new Date()).getFullYear().toString()+(((new Date()).getMonth()+1)<10?'0'+((new Date()).getMonth()+1):(new Date()).getMonth()+1).toString()+(new Date()).getDate().toString()
  //               var params = {
  //                   title: "通知",                           // 标题
  //                   content: ret.status[i].title+"申请参与 "+ret.status[i].name+" 项目",
  //                   date: mydata,                         // 日期
  //                   hour: (new Date()).getHours(),                               // 时间
  //                  min: (new Date()).getMinutes(),                  // 内容
  //               };
  //               var resultCallback = function(ret, err) {
  //                  if (ret.status) {
  //                      console.log("添加通知成功，通知id：" + ret.notiId);
  //                  } else {
  //                      console.log("添加本地通知失败，错误码：" + err.code + "，错误信息：" + err.msg);
  //                  }
  //              };
  //               tencentPush.addlocalNotification(params, resultCallback);
  //             }
  //         }else if($api.getStorage("shenfen")==2){
  //           for(var i in ret.status){
  //             var mydata = (new Date()).getFullYear().toString()+(((new Date()).getMonth()+1)<10?'0'+((new Date()).getMonth()+1):(new Date()).getMonth()+1).toString()+(new Date()).getDate().toString()
  //             if(ret.status[i].type==3){
  //               var params = {
  //                   title: "通知",                           // 标题
  //                   content: ret.status[i].title+"项目被拒绝",                  // 内容
  //                   date:mydata,                         // 日期
  //                   hour: (new Date()).getHours(),                               // 时间
  //                  min: (new Date()).getMinutes(),                                // 分钟
  //               };
  //               var resultCallback = function(ret, err) {
  //                  if (ret.status) {
  //                      console.log("添加通知成功，通知id：" + ret.notiId);
  //                  } else {
  //                      console.log("添加本地通知失败，错误码：" + err.code + "，错误信息：" + err.msg);
  //                  }
  //              };
  //
  //               tencentPush.addlocalNotification(params, resultCallback);
  //             }
  //             }
  //         }
  //
  //
  //             } else {
  //               api.hideProgress();
  //                 console.log( JSON.stringify( err ) );
  //             }
  //            console.log(JSON.stringify( ret ));
  //         });
  //         jstuisong()
  //     } else {
  //
  //         console.log("注册失败，错误码：" + err.code + "，错误信息：" + err.msg);
  //         tongzhi();
  //     }
  // });



api.hideProgress();
api.refreshHeaderLoadDone();
}

function jstuisong(){
  api.ajax({
      url: $api.getStorage("backapi")+'/index.php?s=xiangmu&c=home&m=jstuisong',
      method: 'post',
      data: {
          values: {
              uid:$api.getStorage("member"),
              sf:$api.getStorage("shenfen")
          }
      }
  },function(ret, err){
        if(ret.status){
          // console.log("yes");
        }
  })
}


function lun_ajax(){
  api.ajax({
      url: $api.getStorage("backapi")+'/index.php?c=api&m=data2&auth=1&param=list action=navigator type=0',
      method: 'post',
  },function(ret, err){
      if (ret) {
        imgcache(ret.return)
      } else {
          // console.log( JSON.stringify( err ) );
      }
  });

}

function imgcache(data){
//  console.log(data.length);
  for (var i = 0; i < data.length; i++) {
    var xx = i;
    api.imageCache({
        url: data[i].imgpath
    }, function(ret, err) {
        var url = ret.url;
        // console.log(xx);
        if(xx==0){
        $api.attr($api.byId("img1"), 'src', ret.url);
        $api.setStorage('lbimg1', ret.url);
        }else if(xx==1){
        $api.attr($api.byId("img2"), 'src', ret.url);
        $api.setStorage('lbimg2', ret.url);
        }else if(xx==2){
        $api.attr($api.byId("img3"), 'src', ret.url);
        $api.setStorage('lbimg3', ret.url);
        }
    });
  }

}




function cha_ajax(){

  api.ajax({
      url: $api.getStorage("backapi")+'/index.php?c=home&m=cha_ajax&id='+$api.getStorage("member")+"&sys="+$api.getStorage("sys"),
      method: 'GET',
  },function(ret, err){
      if (ret.status) {
        $api.setStorage('name', ret.status.name);
        $api.setStorage("phone",ret.status.phone);
        $api.setStorage("jianjie",ret.status.jianjie);
        $api.setStorage("zhuangtai",ret.status.zt);
        $api.setStorage("jifen",ret.status.jf);
        $api.setStorage("qiandao",ret.status.qd);
        $api.setStorage("grxx","yes");
        $api.setStorage('shenfen',ret.status.identity);
        $api.setStorage("shebei",ret.status.shebei);
        $api.setStorage("dizhi",ret.status.dizhi);
        $api.setStorage("nianxian",ret.status.jingyan);
        $api.setStorage("age",ret.status.age);
          api.hideProgress();
          api.refreshHeaderLoadDone()
      } else {
        api.refreshHeaderLoadDone()
        api.toast({
            msg: '获取信息失败',
            duration: 2000,
            location: 'bottom'
        });

      }
  });

api.ajax({
    url: $api.getStorage("backapi")+'/index.php?s=jishou&c=home&m=renzheng&uid='+$api.getStorage("member"),
    method: 'post',
},function(ret, err){
    if (ret) {
      if(ret.code == null){
        $api.setStorage('sftg',"null");
      }else if(ret.code.sftg){
        $api.setStorage('sftg',ret.code.sftg);
      }
        //console.log( JSON.stringify( ret ) );
    } else {
      //  console.log( JSON.stringify( err ) );
    }
});
}





function dingshi(){
  if($api.getStorage("member")){
    var demo = api.require('myTimer');
    demo.startTimer({
        step:60,
        isLoop:true
    },function(ret) {
      // tongzhi();
      jingwei()
    });
  }
}


</script>

</html>
